<?php

include '../../db.php';
$connect = pg_connect($connectionString);
if (!$connect) {
    echo "connect : A connection to the server could not be established!";
    return false;
}


$queryString = "SELECT id,fullname as label, name , ruc , address,fullname  as value FROM purcharse_supplier WHERE fullname LIKE '%".strtoupper($_GET['term'])."%'";

$query = pg_query($connect, $queryString);
if (!$query) {
    echo 'query : '.$queryString;
    return false;
}
$arrRegistros = pg_fetch_all($query);
echo json_encode($arrRegistros);
pg_close($connect);
